package com.marisfrolg.entity.json;

import com.lidroid.xutils.db.annotation.Column;
import com.lidroid.xutils.db.annotation.Table;
import com.marisfrolg.entity.EntityBase;

@Table(name = "inbitemsub")
public class InbItemSub extends EntityBase {
	@Column(column = "docid")
	public String DOCID;
	@Column(column = "itemid")
	public String ITEMID;
	@Column(column = "tapos")
	public int TAPOS;
	@Column(column = "productid")
	public String PRODUCTID;
	@Column(column = "productno")
	public String PRODUCTNO;
	@Column(column = "qty")
	public int QTY;
	@Column(column = "checkqty")
	private boolean checkQTY;
	@Column(column = "uom")
	public String UOM;
	@Column(column = "split")
	public String SPLIT;
	@Column(column = "stobin")
	public String STOBIN;
	@Column(column = "ltypt")
	private String LTYPT;
	@Column(column = "inbid")
	private int InbId;
	@Column(column = "total")
	private String total;
	@Column(column = "stotype")
	private String STOTYPE;

	public InbItemSub() {
		TAPOS = 1;
		SPLIT = "";
		STOBIN = "";
		checkQTY = false;
	}

	public InbItemSub(InbItem inbItem) {
		InbId = inbItem.getId();
		DOCID = inbItem.getDOCID();
		ITEMID = inbItem.getITEMID();
		TAPOS = 1;
		PRODUCTID = inbItem.getPRODUCTID();
		QTY = inbItem.getQTY();
		UOM = inbItem.getUOM();
		SPLIT = "";
		STOBIN = "";
		PRODUCTNO = inbItem.getPRODUCTNO();
		total = inbItem.getQTY() + "";
		setLTYPT(inbItem.getLTYPT());
		checkQTY = false;
		STOTYPE=inbItem.STOTYPE;
	}

	public String getDOCID() {
		return DOCID;
	}

	public String getITEMID() {
		return ITEMID;
	}

	public int getTAPOS() {
		return TAPOS;
	}

	public String getPRODUCTID() {
		return PRODUCTID;
	}

	public int getQTY() {
		return QTY;
	}

	public String getUOM() {
		return UOM;
	}

	public String getSPLIT() {
		return SPLIT;
	}

	public String getSTOBIN() {
		return STOBIN;
	}

	public void setDOCID(String dOCID) {
		DOCID = dOCID;
	}

	public void setITEMID(String iTEMID) {
		ITEMID = iTEMID;
	}

	public void setTAPOS(int tAPOS) {
		TAPOS = tAPOS;
	}

	public void setPRODUCTID(String pRODUCTID) {
		PRODUCTID = pRODUCTID;
	}

	public void setQTY(int qTY) {
		QTY = qTY;
	}

	public void setUOM(String uOM) {
		UOM = uOM;
	}

	public void setSPLIT(String sPLIT) {
		SPLIT = sPLIT;
	}

	public void setSTOBIN(String sTOBIN) {
		STOBIN = sTOBIN;
	}

	/**
	 * @return the checkQTY
	 */
	public boolean isCheckQTY() {
		return checkQTY;
	}

	/**
	 * @param checkQTY
	 *            the checkQTY to set
	 */
	public void setCheckQTY(boolean checkQTY) {
		this.checkQTY = checkQTY;
	}

	/**
	 * @return the lTYPT
	 */
	public String getLTYPT() {
		return LTYPT;
	}

	/**
	 * @param lTYPT
	 *            the lTYPT to set
	 */
	public void setLTYPT(String lTYPT) {
		LTYPT = lTYPT;
	}

	/**
	 * @return the inbId
	 */
	public int getInbId() {
		return InbId;
	}

	/**
	 * @param inbId
	 *            the inbId to set
	 */
	public void setInbId(int inbId) {
		InbId = inbId;
	}

	/**
	 * @return the total
	 */
	public String getTotal() {
		return total;
	}

	/**
	 * @param total
	 *            the total to set
	 */
	public void setTotal(String total) {
		this.total = total;
	}

	/**
	 * @return the sTOTYPE
	 */
	public String getSTOTYPE() {
		return STOTYPE;
	}

	/**
	 * @param sTOTYPE
	 *            the sTOTYPE to set
	 */
	public void setSTOTYPE(String sTOTYPE) {
		STOTYPE = sTOTYPE;
	}

	protected InbItemSub split() {
		InbItemSub i = new InbItemSub();
		i.InbId = InbId;
		i.DOCID = DOCID;
		i.ITEMID = ITEMID;
		i.PRODUCTID = PRODUCTID;
		i.PRODUCTNO = PRODUCTNO;
		i.total = total;
		i.STOTYPE=STOTYPE;
		i.SPLIT = "X";
		SPLIT = "X";
		if (QTY > 1) {
			QTY -= 1;
			i.QTY = 1;
		} else {
			i.QTY = 0;
		}
		i.UOM = UOM;
		return i;
	}

}
